package com.dst.smart.handler.disposer;

import android.content.Context;
import android.util.Log;
import com.dst.smart.handler.entity.SemanticResult;
import com.dst.smart.handler.entity.ServiceType;

import org.json.JSONArray;

/**
 * 违章
 * 
 * author <a href="http://www.xfyun.cn">讯飞开放平台</a>
 * date 2016年9月5日 下午4:58:10
 *
 */
public class MotorViolationDisposer extends Disposer {
	//private static final String KEY_URL = "url";

	public MotorViolationDisposer(Context context) {
		super(context);
	}
	
	@Override
	public void disposeResult(final SemanticResult semanticResult) {
		try {
			if (semanticResult != null) {
				JSONArray result = semanticResult.getResult();
				if (result != null && result.length() != 0) {
				} else {
					if (semanticResult.getAnswerText().length() > 0) {
						getPlayController().playURLList(semanticResult.getUUID(), null);
						getPlayController().playText(semanticResult.getUUID(), semanticResult.getAnswerText(), true, "", null);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	
	public boolean canHandle(ServiceType type){
		return (type == ServiceType.MOTORVIOLATION);
	}
}
